home *** CD-ROM | disk | FTP | other *** search
-
- *******************************************************************
- ************************ FILE1 by Rex Kerr ************************
- ************************ Copyright (C) 1989 ***********************
- *******************************************************************
-
- FILE1 is a TP5.5 unit that performs various operations on files.
-
- I wrote this unit after I got tired of writing simple file
- operations over and over again. The one I use most is existfile,
- but the others are also useful. This program also does most of
- the work in a file managing program I wrote, DirPlus. You can
- download it (the file name is 'DPLUS.ARC') from Lib 1 of the BPROGA
- forum on CompuServe.
-
- ***
-
- ExistFile(st : pathstr) : boolean;
-
- This returns true if the filename st exists; otherwise it returns
- false.
-
- ***
-
- CopyFile(fromfile,tofile : pathstr; var result : byte);
-
- This copies the file specified in fromfile to the one specified
- in tofile. The result bytes returns 0 if the operation was
- succesful. If not, it will return one of these error codes:
- 1 : File to copy from does not exist as specified
- 2 : File to copy to already exists as specifed (FILE1 won't
- overwrite existing files.)
- 3 : Heap too small to create file copy buffer (FILE1 needs
- at least 1k of heap, and will use up to 64k, if it is
- available.)
- Copying starts at the destination, not at the source. First the
- destination file is opened, then the source file. Then the
- source file is read, and the destination file is written to. It
- takes a bit of getting used to, but this is the fastest way to copy
- a file.
-
- ***
-
- RenameFile(fromfile,tofile : pathstr; var result : byte);
-
- This renames the file in fromfile to the name in tofile. The result
- byte returns 0 if it is successful. Otherwise, it returns one of
- the non-zero error codes shown below:
- 1 : File to rename does not exist as specified
- 2 : Name to rename to already exists as specified
-
- ***
-
- EraseFile(delfile : pathstr; var result : byte);
-
- EraseFile erases the file named in delfile. The result byte returns
- 0 if it is succesful. If not, it returns one of the below error
- codes:
- 1 : File as specified does not exist to erase
-
- ***
-
- TypeFile(showfile : pathstr; var result : byte);
-
- This types the file named in showfile to the current TP5 window on
- the screen. While it is typing the file out, if any key is pressed,
- it will stop and wait until another key is pressed. When it is,
- the writing to the screen will continue. If ESC is pressed at any
- time during the type, the procedure will end. If typing is
- succesfully started, the result byte will contain 0. Otherwise, it
- will contain one of the error codes shown below:
- 1 : File to type does not exist as specified
- 2 : Heap too small (TypeFile also needs at least 1k of heap,
- it will use up to 64k if that much is available.)
-
- ***
-
- This unit is written in Pascal, not in assembly language. File
- operations are fast enough in TP so that assembly language is not
- needed for speed, and Pascal is much easier to write in.